<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
     div{
        margin: 30px;
        border: 5px solid #000;
        padding: 20px;
        width: 200px;
        height: 100px;
        /* box-sizing: border-box; IE盒模型 */
        /* box-sizing: content-box; 标准盒模型 */
    }
</style>
<body>
    <div id="wrap" style="width: 200px; height: 100px;">hello world</div>
    <script>
        let dom = document.getElementById('wrap')
        // dom.style.width = 300 + 'px'
        // console.log(dom.style.width);

        // console.log(dom.offsetWidth); 能获取不能设置

        // console.log(dom.getBoundingClientRect().width); 能获取不能设置

        // console.log(window.getComputedStyle(dom).width); 能获取

        // console.log(dom.currentStyle.width);  能获取，但是只支持IE

    </script>
</body>
</html>